﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace dzs.Web.monthsked
{
    public partial class Modify :Web.Admin.BasePage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
                {
                    int mid = (Convert.ToInt32(Request.Params["id"]));
                    ShowInfo(mid);
                }
            }
        }

        private void ShowInfo(int mid)
        {
            dzs.BLL.monthsked bll = new dzs.BLL.monthsked();
            DataSet ds = bll.GetList(" and mid=" + mid);
            if (ds.Tables[0].Rows.Count == 1)
            {
                this.lblspotunit.Text = ds.Tables[0].Rows[0]["spotunit"].ToString();
                this.lblprojectname.Text = ds.Tables[0].Rows[0]["projectname"].ToString();
                this.lblsname.Text = ds.Tables[0].Rows[0]["sname"].ToString();
                this.lblname.Text = ds.Tables[0].Rows[0]["material"].ToString();
                this.lblspottype.Text = ds.Tables[0].Rows[0]["spottype"].ToString();
                this.lblspotnum.Text = ds.Tables[0].Rows[0]["spotnum"].ToString();

                this.lblspotcontent.Text = ds.Tables[0].Rows[0]["spotcontent"].ToString();
                this.lblusework.Text = ds.Tables[0].Rows[0]["usework"].ToString();
                this.txtspotopinion.Text = ds.Tables[0].Rows[0]["spotopinion"].ToString();
                this.txtquestion.Text = ds.Tables[0].Rows[0]["question"].ToString();
                this.ddlresult.SelectedValue = ds.Tables[0].Rows[0]["qresult"].ToString();
            }

        }

        public void btnSave_Click(object sender, EventArgs e)
        {
            if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
            {
                int mid = (Convert.ToInt32(Request.Params["id"]));
                string spotopinion = this.txtspotopinion.Text;
                string qresult = this.ddlresult.Text;
                string question = this.txtquestion.Text;
                dzs.Model.monthsked model = new dzs.Model.monthsked();
                model.mid = mid;
                model.spotopinion = spotopinion;
                model.qresult = qresult;
                model.question = question; dzs.BLL.monthsked bll = new dzs.BLL.monthsked();
                bll.Updateresult(model);
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "MyList.aspx");
            }

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
